Skip to content

Remove duplicate keys in alpine DECLARED_TO_SPDX - #5313

Open
Daksha1611 wants to merge 1 commit into
aboutcode-org:developfrom
Daksha1611:fix-alpine-duplicate-spdx-keys
Open

Remove duplicate keys in alpine DECLARED_TO_SPDX#5313
Daksha1611 wants to merge 1 commit into
aboutcode-org:developfrom
Daksha1611:fix-alpine-duplicate-spdx-keys

Conversation

@Daksha1611

Copy link
Copy Markdown

Fixes #5312

DECLARED_TO_SPDX defines 'as-is' twice (lines 1619 and 1701) and 'custom:tu-berlin-2.0' twice (lines 1690 and 1715). It is a plain dict literal, so the earlier entry of each pair was silently dropped at import and never applied.

This removes the two unreachable entries and keeps the values that already win, so the mapping is identical at runtime. Whether the surviving value is the right one for each key is a separate question and left to you — for 'as-is' in particular the entry that was being discarded was the more specific one.

DECLARED_TO_SPDX is a plain dict literal, so a repeated key silently
drops the earlier entry at import time. 'as-is' and 'custom:tu-berlin-2.0'
were each defined twice, leaving two mappings unreachable.

Remove the unreachable entries and keep the values that currently win, so
the mapping is unchanged at runtime. Which value is actually right for each
of the two keys is left to the maintainers in the issue.

Signed-off-by: Daksha1611 <mehtadaksha1611@gmail.com>

@Shriprasad-P Shriprasad-P left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

PR: Remove duplicate keys in alpine DECLARED_TO_SPDX

Touched: CHANGELOG.rst, src/packagedcode/alpine.py

  • Addresses a concrete correctness/reliability issue based on the title and diff.
  • Security-sensitive change — please double-check edge cases and defaults.
  • Size looks manageable (+4/-2).

Commenting as a drive-by reviewer after reading the diff. Happy to look again if maintainers want a deeper pass on a specific file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate keys in alpine DECLARED_TO_SPDX silently discard two license mappings

2 participants